<%@page import="java.sql.SQLException"%>
<%@page import="cn.jhc.bean.ShopBean"%>
<%@page import="cn.jhc.dao.ShopDAO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="common.jsp"%>
<jsp:useBean id="cart" scope="session" class="cn.jhc.bean.CartBean"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/main.css"></link>
<style>
* {
	border: 0;
}
</style>
<title>蓝调吉他社吉他小店</title>
</head>
<body>
	<jsp:include page="additem.jsp" flush="false"/>
	<%
		request.setCharacterEncoding("UTF-8");
		String isbn = request.getParameter("isbn");
		ShopDAO dao = new ShopDAO();
		ShopBean t = null;
		try {
			t = dao.getShop(isbn);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		request.setAttribute("title", t);
	%>
	<div id="wrapper">
		<jsp:include page="./header.jsp"></jsp:include>
		<div id="shopcart">
			<div id="onebook">
				<div class="oneimage" title="${requestScope.title.title}">
					<img src="images/${requestScope.title.imageFile}" width="450"
						height="400" />
				</div>
				<div id="test">
					<p>吉他编号:</p>
					<div class="titletext">
						<a>${requestScope.title.isbn}</a>
					</div>
					<p>吉他样式:</p>
					<div class="titletext">
						<a>${requestScope.title.title}</a>
					</div>
					<p>价 格:</p>
					<div class="titletext">
						<a>${requestScope.title.price}</a>
					</div>
					<p>地 址:</p>
					<div class="titletext">
						<a>${requestScope.title.address}</a>
					</div>
					<p>厂 商:</p>
					<div class="titletext">
						<a>${requestScope.title.manufacturers}</a>
					</div>

				</div>
			</div>
		</div>
		<%
			if(cart.isExist(new Integer(isbn))){
				out.println("商品在购物车中");
			}
			else
			{
		%>
		
		<div id="buttons">
			<form method="post" action="./showjita.jsp">
				<input type="hidden" name="isbn" value="${requestScope.title.isbn}"></input>
				<input type="hidden" name="add" value="${requestScope.title.isbn}"></input>
				<input type="submit" value="加入购物车"></input>
				<div id="button2"></div>
			</form>
		</div>
		<%
		} 
		%>
		<br>购物车中现有<%=cart.getNumOfItems() %>种商品
		&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="showcart.jsp">查看购物车</a>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="showallgoods.do?cond=all">查看所有商品</a>
	</div>
</body>
</html>
